﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteAlways]
public class CustomGUIRoot : MonoBehaviour
{
    private CustomGUIControl[] allControls;
    void Start()
    {
        allControls = this.GetComponentsInChildren<CustomGUIControl>();
    }

    //在这里统一绘制子对象控件的内容
    private void OnGUI()
    {
        allControls = this.GetComponentsInChildren<CustomGUIControl>();
        for (int i=0; i< allControls.Length; i++)
        {
            allControls[i].DrawGUI();
        }
    }
}
